package swingComponents;

import java.awt.Component;

import javax.swing.AbstractCellEditor;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JTable;
import javax.swing.table.TableCellEditor;

public class MyCellEditor extends AbstractCellEditor implements TableCellEditor {

	/**
	 * 
	 */
	private JComponent jComponent;

	private static final long serialVersionUID = 1L;

	@Override
	public Component getTableCellEditorComponent(JTable table, Object value,
			boolean isSelected, int row, int column) {
		if (value instanceof JButton) {
			jComponent = (JButton) value;
		} else if (value instanceof JComboBox) {
			jComponent = (JComboBox) value;
		}
		return jComponent;
	}

	@Override
	public Object getCellEditorValue() {
		return jComponent;
	}
}
